
import { ReactNode, useMemo } from "react";
import { SystemController } from "./SystemController";
import { ModuleController } from "./ModuleController";

export { SystemController } from "./SystemController";
export { ModuleController } from "./ModuleController";
export { MenuController } from "./MenuController";
export type { IModule, ModuleInfo } from "./ModuleController";

/** 全局控制器根 */
export function ControllerRoot(props: { children: ReactNode }) {
    return (
        <ModuleController.Context.Provider value={useMemo(() => new ModuleController(), [])}>
            <SystemController.Context.Provider value={useMemo(() => new SystemController(), [])}>
                {props.children}
            </SystemController.Context.Provider>
        </ModuleController.Context.Provider>
    )
}